﻿using Xtensive.Orm;

namespace NullableFields.Model
{
    [HierarchyRoot]
    public class Book : Entity
    {
        [Field, Key]
        public int Id { get; set; }

        // By default, fields of reference types are nullable. 
        // To change this behavior use [Field(Nullable = false)] construct
        [Field(Nullable = false)]
        public string Title { get; set; }

        // By default, fields of value types are not-nullable
        // To change this behavior, use Nullable<T> contruct or T? notation.
        [Field]
        public int? PublicationYear { get; set; }

        public Book(Session session) :
            base(session) {}
    }
}